package comunicacao;

import entities.Range;
import entities.ServerInfo;
import entities.Teatro;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import entities.Teatro;

/**
 * @author Leonardo Lino Nº45340
 * @author Diogo Pires Nº40351
 */
public interface ReceiveMessageInterface extends Remote {

    // Metodo para saber teatros que existem
    public ArrayList<String> listTheaters() throws RemoteException;

    // metodo para pesquisar por um unico teatro
    public Teatro getTheater(String theaterName) throws RemoteException;

    // reserva de 1 lugar num teatro
    public boolean reserveSeat(String theaterName, int lugarID, int userID, String timestamp, boolean inReplic)
            throws RemoteException;

    //remove a reserva de 1 lugar num teatro
    public boolean removeSeatReserve(String theaterName, int lugarID, int userID, boolean inReplic) throws RemoteException;

    // compra de 1 lugar num teatro
    public boolean purchaseSeat(String theaterName, int lugarID, int userID, boolean inReplic)
            throws RemoteException;

    // metodo para deitar abaixo o servidor
    public boolean falha(boolean failureMode, boolean force) throws RemoteException;

    // metodo para recomeÃ§ar o servidor
    public boolean restart() throws RemoteException;

    //Carrega a base de dados a partir de outra base de dados indicada
    public void loadDatabase(ServerInfo provider, ServerInfo providerReplic, ServerInfo coordinator, Range mainRange, Range coordinatorRange, Range replicRange, int shardingLevel) throws RemoteException;

    //Reorganiza a base de dados na ocorrÃªncia de uma remoÃ§Ã£o
    public void ReorganizeDatabase(ServerInfo departedCoordinator, ServerInfo replic, Range mainRange, Range coordinatorRange, Range replicRange, int removalLevel) throws RemoteException;

    public boolean removeTheater(String theaterName, boolean inReplic) throws RemoteException;

    public boolean writeTheater(Teatro teatro, boolean inReplic) throws RemoteException;

    public Teatro getTheaterInReplic(String theaterName) throws RemoteException;

    public void setNewRange(Range mainRange, Range coordinatorRange, Range replicRange) throws RemoteException;

    public void setReplicInfo(ServerInfo replic) throws RemoteException;

    public void setLeaderInfo(ServerInfo leaderInfo) throws RemoteException;

}
